package com.io.exception;

import lombok.Getter;
import lombok.Setter;

/**
 * The class/interface
 *
 * @author guodd
 * @version 1.0 use jdk 1.8
 */
@Setter
@Getter
public class ScException extends RuntimeException {
    private Integer code;
    private String message;

    private ScException() {
    }

    public ScException(CodeEnum codeEnum) {
        super(codeEnum.getMessage());
        this.code = codeEnum.getCode();
        this.message = codeEnum.getMessage();
    }

    public ScException(Integer code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public ScException(Integer code, String message, Throwable cause) {
        super(message, cause);
        this.code = code;
        this.message = message;
    }

    public ScException(Integer code, Throwable cause) {
        super(cause);
        this.message = cause.getMessage();
    }
}
